{% extends 'base.html' %}
{% block title %}
    <a class="navbar-brand" href="{{ url_for('report_form') }}"> 部门报表管理 </a>
{% endblock %}
{% block write %}
    {% if current_user.has_role('Admin') or current_user.has_role('Root') %}
    <li>
    <a href="{{ url_for('report_form_personnnel_monthly',departmentID=0) }}"
                               class="btn btn-simple btn-danger btn-icon remove">人事月报</a>
    </li>
    {% endif %}
{% endblock %}
{% block content %}
    {# 使用 length 过滤器获取 staffs 变量的长度 #}
    {% if current_user.has_role('Admin') or current_user.has_role('Root') %}

    {% endif %}
    {% if current_user.has_role('Admin') or current_user.has_role('Root') %}
        <div class="content">
            <h4 class="title">部门报表管理</h4>
            <div class="toolbar">
                <!--        Here you can write extra buttons/actions for the toolbar              -->
            </div>
            <div class="material-datatables">
                <table id="datatables" class="table table-striped table-no-bordered table-hover"
                       style="width:100%;cellspacing:0">
                    <thead>
                    <tr>
                        <th>部门编号</th>
                        <th>部门</th>
                        <th>新聘员工报表</th>
                        <th>离职员工报表</th>
                    </tr>
                    </thead>

                    <tbody>
                    <tr>
                        <td>0</td>

                        <td>全部</td>

                        <td>
                            <a href="{{ url_for('report_form_newstaff',departmentID=0) }}"
                               class="btn btn-simple btn-info btn-icon like">新聘员工报表</a>
                        </td>
                        <td>
                            <a href="{{ url_for('report_form_dimission',departmentID=0) }}"
                               class="btn btn-simple btn-warning btn-icon edit">离职员工报表</a>
                        </td>
                    </tr>
                    {% for department in departments %}
                        <tr>
                            <td>{{ department.departmentID }}</td>

                            <td>{{ department.departmentname }}</td>

                            <td>
                                <a href="{{ url_for('report_form_newstaff',departmentID=department.departmentID) }}"
                                   class="btn btn-simple btn-info btn-icon like">新聘员工报表</a>
                            </td>
                            <td>
                                <a href="{{ url_for('report_form_dimission',departmentID=department.departmentID) }}"
                                   class="btn btn-simple btn-warning btn-icon edit">离职员工报表</a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>

                </table>
            </div>

        </div>
    {% endif %}

{% endblock %}